// 常量路由(所有用户均可访问)
// 不写hidden，默认为undefined，效果等同于false（表示该菜单项不显示在菜单中）
export const constantRoute = [
  // 登录
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    // 路由别名
    name: 'login',
    meta: {
      title: '登录',
      hidden: true, // 路由标题是否隐藏
    },
  },
  // 首页
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    name: 'layout',
    redirect: '/home',
    meta: {
      title: 'layout',
      hidden: true,
    },
    children: [
      {
        path: '/home',
        component: () => import('@/views/home/index.vue'),
        name: 'home',
        meta: {
          title: '首页',
          icon: 'HomeFilled',
        },
      },
    ],
  },
  // 数据大屏
  {
    path: '/screeen',
    component: () => import('@/views/screen/index.vue'),
    name: 'screen',
    meta: {
      title: '数据大屏',
      icon: 'DataLine',
    },
  },
  // 404
  {
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404',
    meta: {
      title: '404',
      hidden: true,
    },
  },
]

// 异步路由
export const asyncRoute = [
  // 权限管理
  {
    path: '/acl',
    // 此处为layout 的 index.vue 整体布局文件
    component: () => import('@/layout/index.vue'),
    name: 'Acl',
    meta: {
      title: '权限管理',
      icon: 'HelpFilled',
    },
    children: [
      {
        path: '/acl/user',
        component: () => import('@/views/acl/user.vue'),
        name: 'User',
        meta: {
          title: '用户管理',
          icon: 'User',
        },
      },
      {
        path: '/acl/role',
        component: () => import('@/views/acl/role.vue'),
        name: 'Role',
        meta: {
          title: '角色管理',
          icon: 'Avatar',
        },
      },
      {
        path: '/acl/permission',
        component: () => import('@/views/acl/permission.vue'),
        name: 'Permission',
        meta: {
          title: '菜单管理',
          icon: 'Monitor',
        },
      },
    ],
  },
  // 商品管理
  {
    path: '/product',
    component: () => import('@/layout/index.vue'),
    name: 'Product',
    meta: {
      title: '商品管理',
      icon: 'Goods',
    },
    children: [
      {
        path: '/product/trademark',
        component: () => import('@/views/product/trademark.vue'),
        name: 'Trademark',
        meta: {
          title: '品牌管理',
          icon: 'ShoppingCartFull',
        },
      },
      {
        path: '/product/attr',
        component: () => import('@/views/product/attr.vue'),
        name: 'Attr',
        meta: {
          title: '属性管理',
          icon: 'Briefcase',
        },
      },
      {
        path: '/product/spu',
        component: () => import('@/views/product/spu/index.vue'),
        name: 'Spu',
        meta: {
          title: 'SPU管理',
          icon: 'Calendar',
        },
      },
      {
        path: '/product/sku',
        component: () => import('@/views/product/sku.vue'),
        name: 'Sku',
        meta: {
          title: 'SKU管理',
          icon: 'Shop',
        },
      },
    ],
  },
]

// 任意路由
export const anyRoute = [
  // 其他路由
  {
    // 不明路径，路由重定向
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    name: 'any',
    meta: {
      title: '访问的页面不存在',
      hidden: true,
    },
  },
]
